home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1996 March / EnigmA AMIGA RUN 05 (1996)(G.R. Edizioni)(IT)[!][issue 1996-03][Skylink CD IV].iso / earcd / patches / pgs3h1.lha / 3.0hUpdate / Macros.LHA / SendtoTurboText.rexx < prev   
OS/2 REXX Batch file  |  1995-06-15  |  3KB  |  118 lines

  1. /* $VER: SendtoTurboText.rexx 1.4 (12.06.95)
  2.    Copyright 1995 Soft-Logik Publishing Corporation
  3.    May not be distributed without Soft-Logik Publishing Corporation's express written permission */
  4.  
  5. OPTIONS RESULTS
  6. TRACE OFF
  7.  
  8. /* Make sure rexx support is opened */
  9. IF ~SHOW('L','rexxsupport.library') THEN
  10.    CALL ADDLIB('rexxsupport.library',0,-30)
  11.  
  12. ADDRESS 'PAGESTREAM'
  13.  
  14. /* If text is not selected, select the current article */
  15. getcursor characterstart sID characterend eID
  16. if sID=eID then 'selecttext all'
  17.  
  18. /* Export the article to a temp file */
  19. 'lockinterface true'
  20. 'exporttext file t:HotLinkedArticle filter ascii textcode PageStream status force'
  21. /* Eventually will just make article external, but not this version */
  22. /* 'editarticle external file t:HotLinkedArticle' */
  23. 'refresh wait'
  24.  
  25. /* set the default TurboText path */
  26. ttxpath='TurboText:TTX'
  27. preffile='PageStream3:SendtoTurboText.prefs'
  28.  
  29. /* If TurboText doesn't exist in the default path, check SendtoTurboText.prefs */
  30. if ~exists(ttxpath) then do
  31.     if open(.ifile, preffile, 'R') then do
  32.         ttxpath=readln(.ifile)
  33.         call close(.ifile)
  34.         askuser='no'
  35.         end
  36.     else do
  37.         askuser='yes'
  38.     end
  39.     /* If TurboText doesn't exist in the set pref path, ask the user where it is */
  40.     if ~exists(ttxpath) | askuser='yes' then do
  41.         getfile TITLE "'Please locate TurboText'" load path "'TurboText:'" file 'TTX' posbutton 'Ok' negbutton 'Cancel'
  42.         if RC=10 then signal cancel
  43.         ttxpath=result
  44.         if open(.ifile, preffile, 'W') then do
  45.             call writeln(.ifile, ttxpath)
  46.             call close(.ifile)
  47.         end
  48.     end
  49. end
  50.  
  51.  
  52. /* Run TurboText */
  53. ADDRESS COMMAND
  54. 'run >nil:' ttxpath' t:HotLinkedArticle'
  55.  
  56. /* Wait until the ARexx port shows up */
  57. do 20
  58.     if ~show(P, 'TURBOTEXT') then call delay(50)
  59. end
  60.  
  61. ADDRESS 'TURBOTEXT'
  62. do 20
  63.     getport 'HotLinkedArticle'
  64.     portname=result
  65.     if portname~=result then call delay(50)
  66. end
  67.  
  68.  
  69. /* If the ARexx port didn't show up, alert the user and exit */
  70. if ~show(P, 'TURBOTEXT') then do
  71.     ADDRESS 'PAGESTREAM'
  72.     allocarexxrequester '"Send to Editor Error!"' 368 59
  73.     reqhandle=result
  74.     addarexxgadget reqhandle EXIT 286 42 70 label "_Exit"
  75.         Exithandle=result
  76.     addarexxgadget reqhandle TEXT 8 10 352 border none string "'TurboText could not be started.'"
  77.     doarexxrequester reqhandle
  78.     freearexxrequester reqhandle
  79.     'refresh continue'
  80.     'lockinterface false'
  81.     EXIT
  82. end
  83.  
  84. /* Wait for the user to finish in TurboText */
  85. address 'TURBOTEXT'
  86. do forever
  87.     if show(P, portname) then do
  88.         getport 'HotLinkedArticle'
  89.         if rc=0 then call delay(50)
  90.         else signal update
  91.     end
  92.     else signal update
  93. end
  94.  
  95. /* Update PageStream and exit */
  96. UPDATE:
  97. ADDRESS 'PAGESTREAM'
  98. 'screentofront'
  99. 'revealwindow current'
  100. /* Eventually will just make article external, but not this version */
  101. /* 'editarticle path t:HotLinkedArticle' */
  102. /* 'editarticle internal' */
  103.  
  104. 'inserttext file t:HotLinkedArticle filter ascii textcode PageStream'
  105.  
  106. /* deselect the text if rquired */
  107. if sID=eID then selecttext none
  108.  
  109. signal cancel
  110.  
  111. CANCEL:
  112. ADDRESS 'PAGESTREAM'
  113. 'refresh continue'
  114. 'lockinterface false'
  115. ADDRESS COMMAND
  116. 'delete t:HotLinkedArticle >NIL:'
  117. EXIT
  118.